﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AmazonDynamoDBStub.Models
{
    public static class DynamoDBTableFactory
    {
        private const string DefaultTableStatus = "ACTIVE";

        public static DynamoDBTable Create(string tableName, DateTime creationDateTime, string tableStatus, DynamoDBKey hashKey, DynamoDBKey rangeKey = default(DynamoDBKey))
        {
            return new DynamoDBTable
            {
                TableName = tableName,
                CreationDateTime = creationDateTime,
                TableStatus = tableStatus,
                HashKey = hashKey,
                RangeKey = rangeKey,
            };
        }

        public static DynamoDBTable Create(string tableName, string hashKeyAttributeName, string hashKeyAttributeType, string rangeKeyAttributeName = null, string rangeKeyAttributeType = null)
        {
            return Create(tableName, DateTime.UtcNow, DefaultTableStatus, hashKeyAttributeName, hashKeyAttributeType, rangeKeyAttributeName, rangeKeyAttributeType);
        }

        public static DynamoDBTable Create(string tableName, DateTime creationDateTime, string tableStatus, string hashKeyAttributeName, string hashKeyAttributeType, string rangeKeyAttributeName = null, string rangeKeyAttributeType = null)
        {
            return Create(tableName, creationDateTime, tableStatus, new DynamoDBKey(hashKeyAttributeName, hashKeyAttributeType), new DynamoDBKey(rangeKeyAttributeName, rangeKeyAttributeType));
        }
    }
}
